#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
struct rank
{
	int num;
	char na[100];
	int score;
	int attend;
	float sum;
	int rank;
};
int main()
{
	struct rank s[30];
	int n = 0;
	while (scanf("%d", &n) == 1)
	{
		int i = 0;
		for (i = 0; i < n; i++)
		{
			scanf("%d%s%d%d", &s[i].num,
				s[i].na,
				&s[i].score, &s[i].attend);
			s[i].sum = s[i].score * 0.8 + s[i].attend * 0.2;
			s[i].rank = i + 1;
		}
		int j = 0;
		for (i = 0; i < n - 1; i++)
		{
			for (j = 0; j < n - 1; j++)
			{
				if (s[j].sum < s[j + 1].sum)
				{
					int tmp = s[j + 1].num;
					s[j + 1].num = s[j].num;
					s[j].num = tmp;
					char name[100];
					strcpy(name, s[j + 1].na);
					strcpy(s[j + 1].na, s[j].na);
					strcpy(s[j].na, name);
					tmp = s[j + 1].sum;
					s[j + 1].sum = s[j].sum;
					s[j].sum = tmp;
				}

			}
		}
		for (i = 0; i < n; i++)
		{
			printf("%d %s %.1f %d\n", s[i].num,
				s[i].na, s[i].sum, s[i].rank);
		}

	}
	return 0;
}